/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.tspp.common;

import com.tspp.dao.DaoException;
import com.tspp.dao.DaoFactory;
import com.tspp.dao.UserDao;
import com.tspp.dao.UserType;
import com.tspp.dao.dto.User;


/**
 * Class that is used to check whether the user has the permissions to use the system
 * @author Maks
 */
public class AuthorizationBean {

    /**
     * Determine user's role
     * @param login user's login
     * @param password user's password
     * @return user's role
     * @throws DaoException
     */
    public UserType getRoleOfUser(String login, String password) throws DaoException {
        User user = new User();
        user.setLogin(login);
        user.setPassword(password);
        UserDao dao = DaoFactory.getUserDao();
        return dao.getTypeOfUser(user);
    }
}
